<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>工作流管理</title>
    <meta name="keywords" content="工作流管理">
    <meta name="description" content="工作流管理">

    <link rel="shortcut icon" href="favicon.ico">
    <link th:href="(${@viewConfig.getRemoteViewUrl()})+'asset/js/bootstrap/css/bootstrap.min.css'"
          href="../asset/js/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link th:href="(${@viewConfig.getRemoteViewUrl()})+'asset/css/fonts/iconfont.css'"
          href="../asset/css/fonts/iconfont.css" rel="stylesheet">
    <link th:href="(${@viewConfig.getRemoteViewUrl()})+'asset/js/plugins/jqgrid/ui.jqgridffe4.css'"
          href="../asset/js/plugins/jqgrid/ui.jqgridffe4.css" rel="stylesheet">
    <link th:href="(${@viewConfig.getRemoteViewUrl()})+'asset/css/animate.min.css'" href="../asset/css/animate.min.css"
          rel="stylesheet">
    <link th:href="(${@viewConfig.getRemoteViewUrl()})+'asset/css/style.min862f.css'"
          href="../asset/css/style.min862f.css" rel="stylesheet">


</head>

<body class="gray-bg">
<div class="animated fadeInRight">
    <div class="ibox ">
        <div class="ibox-title ">
            <div class="row">
                <form class="form-inline" id="formSearch">
                    <div class="col-sm-6 form-group">
                        <label style="width: 60px">流程名称</label>
                        <input type="text" name="loginName" placeholder="请输入登录名" class="form-control">
                    </div>

                    <div class="col-sm-6 form-group">
                        <button id="btnRest" onclick="reset()" class="btn btn-primary btn-xs skin_blue_buttom"
                                style="float: right; margin-left: 10px" type="button"><i
                                class="icon egojit-front icon-add"></i>&nbsp;重置
                        </button>
                        <button id="btnSearch" onclick="search()" class="btn btn-warning btn-xs" type="button"
                                style="float: right;"><i class="icon egojit-front icon-search"></i>&nbsp;搜索
                        </button>
                    </div>
                </form>
            </div>

        </div>
        <div class="ibox-content" style="padding-top: 10px">
            <div class="row" style="margin-bottom: 10px">
                <button id="btnDelete" onclick="del()" class="btn btn-primary btn_no_radius btn-xs " type="button"><i
                        class="icon egojit-front icon-delete"></i>&nbsp;删除
                </button>
                <button id="btnAdd" onclick="add()" class="btn btn-primary btn_no_radius btn-xs " type="button"><i
                        class="icon egojit-front icon-add"></i>&nbsp;添加
                </button>
            </div>
            <div class="jqGrid_wrapper">
                <table id="table_list"></table>
                <div id="pager_list"></div>
            </div>
        </div>
    </div>
</div>

<script th:src="(${@viewConfig.getRemoteViewUrl()})+'asset/js/jquery/jQuery-2.2.0.min.js'"
        src="../asset/js/jquery/jQuery-2.2.0.min.js"></script>
<script th:src="(${@viewConfig.getRemoteViewUrl()})+'asset/js/bootstrap/js/bootstrap.min.js'"
        src="../asset/js/bootstrap/js/bootstrap.min.js"></script>
<script th:src="(${@viewConfig.getRemoteViewUrl()})+'asset/js/plugins/peity/jquery.peity.min.js'"
        src="../asset/js/plugins/peity/jquery.peity.min.js"></script>
<script th:src="(${@viewConfig.getRemoteViewUrl()})+'asset/js/plugins/jqgrid/i18n/grid.locale-cnffe4.js'"
        src="../asset/js/plugins/jqgrid/i18n/grid.locale-cnffe4.js"></script>
<script th:src="(${@viewConfig.getRemoteViewUrl()})+'asset/js/plugins/jqgrid/jquery.jqGrid.minffe4.js'"
        src="../asset/js/plugins/jqgrid/jquery.jqGrid.minffe4.js"></script>
<script th:src="(${@viewConfig.getRemoteViewUrl()})+'asset/js/plugins/layer/layer.js'"
        src="../asset/js/plugins/layer/layer.js"></script>
<script th:src="(${@viewConfig.getRemoteViewUrl()})+'asset/js/comm.js'" src="../asset/js/comm.js"></script>
<!--<script src="js/content.min.js?v=1.0.0"></script>-->
<script type="text/javascript">
    var $jqGridObj;
    //删除
    function del(id) {
        var selectIds = [];
        if (!id || id.length <= 0) {
            selectIds = $jqGridObj.list.jqGrid('getGridParam', 'selarrrow');
            console.log(selectIds);
        } else {
            selectIds.push(id);
        }
        if (selectIds == null || selectIds.length < 1) {
            app.tip("请选择数据!");
            return;
        }
        app.confirm("确定删除该数据？", function () {
            app.post("/admin/workflow/process/delete", {ids: JSON.stringify(selectIds)}, function (data) {
                app.close();
                app.tip("删除成功！");
                $jqGridObj.list.trigger("reloadGrid");
            })
        })
    };

    //新增
    function add() {
        app.windows("编辑", "/admin/workflow/process/edit", "900px", "550px");
    }

    //编辑
    function edit(id) {
        app.windows("详情", "/admin/workflow/process/edit?id=" + id, "900px", "550px");
    }

    //编辑
    function detail(id) {
        app.windows("详情", "/admin/workflow/process/edit?id=" + id, "900px", "600px");
    }

    /**
     * 重置
     */
    function reset() {
        $("#formSearch").reset();

    }

    $(document).ready(function () {
        //列表初始化
        $jqGridObj = app.list({
            url: "/admin/workflow/process/index",
            colNames: ["流程名称", "版本", "key", "流程图文件", "分类", "操作"],
            colModel: [{
                name: "name",
                index: "name",
                width: 80
            },
                {
                    name: "version",
                    index: "version",
                    width: 60
                },
                {
                    name: "key",
                    index: "key",
                    width: 60
                },
                {name: "resourceName", index: "resourceName", width: 80},
                {name: "category", index: "category"},
                {
                    name: "key",
                    index: "key",
                    width: 60,
                    formatter: function (cellvalue, options, rowObject) {
                        return '<span class="center-block text-center">' +
                            '<button  class="btn btn-info btn-xs " onclick="edit(\'' + cellvalue + '\')" type="button" style="margin-right: 5px;margin-left: 5px" ><i class="icon egojit-front icon-edit"></i>&nbsp;修改</button>' +
                            '<button id="btnDetail" onclick="del(\'' + cellvalue + '\')"  class="btn btn-default btn-xs" type="button" style="margin-right: 5px;margin-left: 5px"><i class="icon egojit-front icon-delete"></i>&nbsp;删除</button>' +
                            '</span>';
                    }
                }
            ]
        });

    });
</script>
</body>
</html>
